#include "login.h"
#include "ui_login.h"
#include "mainwindow.h"
#include <qmessagebox.h>

login::login(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::login)
{
    ui->setupUi(this);
    QFont ft;
    ft.setPointSize(13);
    ui->name->setFont(ft);
    ui->passwd->setFont(ft);
    ui->passwd->setEchoMode(QLineEdit::Password);
    setWindowFlags(windowFlags()&~Qt::WindowMaximizeButtonHint);
    this->setWindowTitle("LOGIN");


//    QDir temDir("./adbTools");
//    QString absDir = temDir.absolutePath();
//    qDebug()<<"绝对路径" <<absDir;

//    QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
//    QProcess* myProcess = new QProcess(this);
//    QString path = absDir+";" + qgetenv("PATH");
//    qputenv("PATH", path.toStdString().c_str());
//    myProcess->setProcessEnvironment(env);
//    myProcess->start("App.exe");

}

login::~login()
{
    delete ui;
}

void login::on_login_2_clicked()
{
    this->close();
    MainWindow *w = new MainWindow();
    w->show();
    return;
    if (ui->name->text().isEmpty() || ui->passwd->text().isEmpty()) {
        QMessageBox::warning(NULL, "!", "Please enter information", "OK");
        return;
    }
    if (ui->name->text() == "admin" && ui->passwd->text() == "ey0901") {
        this->close();
        MainWindow *w = new MainWindow();
        w->show();

    } else {
        QMessageBox::warning(NULL, "!", "The input information is incorrect", "OK");
    }
}

void login::on_exit_clicked()
{
    this->close();
}
